/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model.pojo;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Yasith
 */
@Entity
@Table(name = "userprivilages")
@NamedQueries({@NamedQuery(name = "UserPrivilage.findByUserprivilageID", query = "SELECT u FROM UserPrivilage u WHERE u.userprivilageID = :userprivilageID"), @NamedQuery(name = "UserPrivilage.findByCreationDate", query = "SELECT u FROM UserPrivilage u WHERE u.creationDate = :creationDate")})
public class UserPrivilage implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue
    @Column(name = "userprivilageID", nullable = false)
    private Integer userprivilageID;
    @Column(name = "creationDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date creationDate;
    @JoinColumn(name = "userRoleId", referencedColumnName = "userRoleId")
    @ManyToOne
    private UserRole userRoleId;
    @JoinColumn(name = "userLevelId", referencedColumnName = "userLevelId")
    @ManyToOne
    private UserLevel userLevelId;

    public UserPrivilage() {
    }

    public UserPrivilage(Integer userprivilageID) {
        this.userprivilageID = userprivilageID;
    }

    public Integer getUserprivilageID() {
        return userprivilageID;
    }

    public void setUserprivilageID(Integer userprivilageID) {
        this.userprivilageID = userprivilageID;
    }

    public Date getCreationDate() {
        return creationDate;
    }

    public void setCreationDate(Date creationDate) {
        this.creationDate = creationDate;
    }

    public UserRole getUserRoleId() {
        return userRoleId;
    }

    public void setUserRoleId(UserRole userRoleId) {
        this.userRoleId = userRoleId;
    }

    public UserLevel getUserLevelId() {
        return userLevelId;
    }

    public void setUserLevelId(UserLevel userLevelId) {
        this.userLevelId = userLevelId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (userprivilageID != null ? userprivilageID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UserPrivilage)) {
            return false;
        }
        UserPrivilage other = (UserPrivilage) object;
        if ((this.userprivilageID == null && other.userprivilageID != null) || (this.userprivilageID != null && !this.userprivilageID.equals(other.userprivilageID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.pojo.UserPrivilage[userprivilageID=" + userprivilageID + "]";
    }

}
